<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>AI工具</title>
</head>

<?php
// index.php
session_start();
include('./config/config.php');
$dbConnection = new mysqli(DB_HOST, DB_USER, DB_PWD, DB_NAME);
if ($dbConnection->connect_error) {
    die("Connection failed: " . $dbConnection->connect_error);
}


include('./class/functions.php');
$controller = new LoginController($dbConnection);

$action = isset($_GET['action']) ? $_GET['action'] : '';

switch ($action) {
    case 'login':
        $controller->login();
        break;
	case 'logout':
		$controller->logout();
		break;
    default:
        $controller->index();
        break;
}

$dbConnection->close();
?>
<body>
</body>
</html>